/*
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * RSTriangles.h
 *
 *  Created on: 2010/02/27
 *      Author: Alexandre Pires ( c.alexandre.pires@gmail.com )
 */

#ifndef RSTRIANGLES_H_
#define RSTRIANGLES_H_

#include "RSGeneralDefs.h"
#include "RSErrors.h"
#include "RSTypes.h"

#include "RSPrimitivesElement.h"

namespace Realsphere {

    class RSTriangles: public Realsphere::RSPrimitivesElement {
        Q_OBJECT
        public:
            Q_INVOKABLE RSTriangles ( const QString& rName = QString::null );
            virtual ~RSTriangles();

        public:
            unsigned int            Count () const;
            RSPrimitiveIndices*     PrimitiveIndices () const;
            RSInput*                GetInput ( unsigned int rIndex ) const;
            int                     IndexOf ( RSInput* rInput );
            unsigned int            InputsSize ();
            RSInputs                Inputs () const;
            RSInputs                Inputs ( RSInputSemanticType rSemanticType ) const;
            RSInputsIterator        InputsIterator () const;
            RSInputsIterator        InputsIterator ( RSInputSemanticType rSemanticType ) const;
            bool                    IsRootElement () const;

        public slots:
            RSError                 AddInput ( RSInput* rInput );
            RSError                 RemoveInput ( RSInput* rInput );
            RSError                 RemoveInput ( unsigned int rIndex );
            RSError                 RemoveInputs ( RSInputSemanticType rSemanticType );
            RSError                 SetPrimitiveIndices ( RSPrimitiveIndices* rPrimitiveIndices );

        signals:
            void                    InputAdded ( RSInput* rInput );
            void                    InputRemoved ( RSInput* rInput );
            void                    PrimitiveIndicesChanged ( RSPrimitiveIndices* rPrimitiveIndices );

        protected:
            RSError                 BeforeAddChildElement ( RSElement* rChild );
            bool                    AfterAddChildElement ( RSElement* rChild );
            bool                    AfterRemoveChildElement ( RSElement* rChild );

        private:
            RSInputs                mInputs;
            RSPrimitiveIndices*     mPrimitiveIndices;
    };

}

#endif /* RSTRIANGLES_H_ */
